package RMIServer;

import java.io.Serializable;

public class User implements Serializable {
	private static final long serialVersionUID = 8123748828957256369L;
	
	private String username;
	private String password;
	private String realName;
	private long bankAccount;
	private double credit;
	
	public User(String username, String password, String realName, long bankAccount) {
		this.username=username;
		this.password=password;
		this.realName=realName;
		this.bankAccount=bankAccount;
		this.credit=0;
	}
	
	public boolean isThisYou(String username,String password) {
		return username.equals(this.username) && password.equals(this.password);
	}
	
	public void withdrawCredit(double amount) {
		credit -= amount;
	}
	
	public void addCredit(double amount) {
		credit += amount;
	}
	
	public double interogateCredit() {
		return credit;
	}
	
	public String name() {
		return realName;
	}
	
	public String username() {
		return username;
	}
}
